package operation;

import Book.Book;
import Book.BookList;

import java.util.Scanner;

/**
 * Created with Intellij IDEA.
 * Description:
 * User: 33013
 * Date: 2023-02-28
 * Time: 12:29
 */
public class AddOperation implements IOperation{

    @Override
    public void work(BookList bookList) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入要添加的书名：");
        String name = scanner.nextLine();
        System.out.println("请输入书的类型：");
        String type = scanner.nextLine();
        System.out.println("请输入书的作者：");
        String writer = scanner.nextLine();
        System.out.println("请输入书的价格：");
        int price = scanner.nextInt();
        boolean exist = true;
        Book book = new Book(name,writer,price,type,exist);
        bookList.bookslist[bookList.capacity] = book;
        bookList.capacity++;
    }
}
